home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2004 August / The Sunday Times - The Month 2004-08.iso / pc / engine / modules / image_enlarge.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2004-06-24  |  4.9 KB  |  154 lines

  1. function loadImage(mc, node, extrapath)
  2. {
  3.    var _loc3_ = extrapath;
  4.    if(_loc3_ == null)
  5.    {
  6.       _loc3_ = "";
  7.    }
  8.    var strDefaultPath = Tardis.ASSETS_FOLDER + "images/" + Tardis.ActiveSection.id + "/";
  9.    var _loc1_ = node.firstChild.nodeValue;
  10.    var _loc2_ = node.attributes.path;
  11.    if(_loc2_ != null)
  12.    {
  13.       _loc1_ = _loc2_ + _loc1_;
  14.    }
  15.    else
  16.    {
  17.       _loc1_ = strDefaultPath + _loc3_ + _loc1_;
  18.    }
  19.    if(strPathPrefix == null)
  20.    {
  21.       strPathPrefix = "";
  22.    }
  23.    mc.loadMovie(strPathPrefix + _loc1_);
  24. }
  25. function resume()
  26. {
  27.    videoCloseFullscreen();
  28. }
  29. function init()
  30. {
  31.    var _loc2_ = Tardis.ActiveSection.id;
  32.    var _loc1_ = Tardis.Colors;
  33.    strColor = _loc1_.getString(_loc2_);
  34.    strColor2 = _loc1_.getString(_loc2_ + "50");
  35.    SECTION_COLOR = _loc1_.getHex(_loc2_);
  36.    DEFAULT_COLOR = _loc1_.getHex("default");
  37.    DEFAULT_COLOR50 = _loc1_.getHex("default50");
  38.    var _loc3_ = {x:15,y:112};
  39.    this.globalToLocal(_loc3_);
  40.    X_OFFSET = _loc3_.x;
  41.    Y_OFFSET = _loc3_.y;
  42.    mc_close._x = CANVAS_LEFT + X_OFFSET;
  43.    mc_close._y = CANVAS_BOTTOM + 5 + Y_OFFSET;
  44.    build();
  45.    onComplete();
  46. }
  47. function build()
  48. {
  49.    var _loc1_ = CANVAS_LEFT;
  50.    var _loc3_ = CANVAS_RIGHT;
  51.    FULLSCREEN_WIDTH = CANVAS_WIDTH;
  52.    FULLSCREEN_LEFT = _loc1_;
  53.    CANVAS_PARAMS = "\"" + _loc1_ + "\",\"" + CANVAS_TOP + "\",\"" + _loc3_ + "\",\"" + CANVAS_BOTTOM + "\"";
  54.    loadImage(mc_image.mc_images,nodeData.byName("thumb"));
  55.    loadImage(mc_image.mc_images2,nodeData.byName("image"));
  56.    mc_image.mc_images2._visible = false;
  57.    var _loc2_ = nodeData.byName("buttons");
  58.    mc_controls.mc_fullscreen_btn.btn.txt.htmlText = _loc2_.byName("fullscreen").getText();
  59.    mc_controls.mc_fullscreen_btn.btn.txt.autosize = "center";
  60.    var fullcol = new Color("mc_controls.mc_fullscreen_btn.btn");
  61.    fullcol.setRGB(DEFAULT_COLOR50);
  62.    mc_close.btn.txt.htmlText = _loc2_.byName("closefull").getText();
  63.    mc_close.btn.txt.autosize = "left";
  64.    var fullcol = new Color("mc_controls.btn");
  65.    fullcol.setRGB(DEFAULT_COLOR50);
  66.    this.onEnterFrame = function()
  67.    {
  68.       checkLoad();
  69.    };
  70.    var pt = {x:0,y:0};
  71.    this.localToGlobal(pt);
  72. }
  73. function videoGoFullscreen()
  74. {
  75.    mc_controls.mc_fullscreen_btn.gotoAndStop("hide");
  76.    this._visible = true;
  77.    Tardis.sideMenu._visible = false;
  78.    Tardis.adverts._visible = false;
  79.    Tardis.bottomNav.disable();
  80.    mc_image.mc_images._visible = false;
  81.    mc_image.mc_images2._visible = true;
  82.    mc_image.mc_images2._x = (CANVAS_WIDTH - mc_image.mc_images2._width) / 2;
  83.    mc_controls._visible = false;
  84.    mc_close.gotoAndStop("show");
  85.    mc_image._x = X_OFFSET;
  86.    mc_image._y = Y_OFFSET;
  87.    noteFF._x = mc_image._x + mc_image.mc_images2._x + mc_image.mc_images2._width;
  88.    noteFF._y = mc_image._y + mc_image.mc_images2._y + mc_image.mc_images2._height;
  89.    mc_image.maskerMC._width = CANVAS_WIDTH;
  90.    mc_image.maskerMC._height = CANVAS_HEIGHT + 40;
  91. }
  92. function videoCloseFullscreen()
  93. {
  94.    mc_controls.mc_fullscreen_btn.gotoAndStop("show");
  95.    mc_close.gotoAndStop("hide");
  96.    Tardis.sideMenu._visible = true;
  97.    Tardis.adverts._visible = true;
  98.    Tardis.bottomNav.enable();
  99.    mc_image.mc_images._visible = true;
  100.    mc_image.mc_images2._visible = false;
  101.    mc_controls._visible = true;
  102.    mc_image._x = 0;
  103.    mc_image._y = 0;
  104.    noteFF._x = mc_image.mc_images._x + mc_image.mc_images._width;
  105.    noteFF._y = mc_image.mc_images._y + mc_image.mc_images._height;
  106.    mc_image.maskerMC._width = IMG_WIDTH;
  107.    mc_image.maskerMC._height = IMG_HEIGHT;
  108. }
  109. function checkLoad()
  110. {
  111.    if(mc_image.mc_images._width > 0 && mc_image.mc_images2._width > 0)
  112.    {
  113.       mc_image.mc_images2._visible = false;
  114.       IMG_WIDTH = mc_image.mc_images._width;
  115.       IMG_HEIGHT = mc_image.mc_images._height;
  116.       mc_image.maskerMC._width = IMG_WIDTH;
  117.       mc_image.maskerMC._height = IMG_HEIGHT;
  118.       if(mc_image.mc_images._height < 395)
  119.       {
  120.          mc_controls._y = mc_image.mc_images._y + IMG_HEIGHT + 7;
  121.          controlsY = mc_controls._y;
  122.          controlsX = mc_controls._x;
  123.          mc_controls._visible = true;
  124.       }
  125.       var _loc1_ = nodeData.byName("note");
  126.       if(_loc1_.getText() != null)
  127.       {
  128.          noteFF.htmlText = nodeData.byName("note").getText();
  129.          noteFF._x = mc_image.mc_images._width;
  130.          noteFF._y = mc_image.mc_images._height + 2;
  131.          noteFF.textColor = DEFAULT_COLOR;
  132.          noteFF.autosize = left;
  133.       }
  134.       delete onEnterFrame;
  135.       _visible = true;
  136.    }
  137. }
  138. _visible = false;
  139. stop();
  140. onReady();
  141. mc_controls._visible = false;
  142. blnFullscreen = 0;
  143. CANVAS_LEFT = 15;
  144. CANVAS_TOP = 112;
  145. CANVAS_HEIGHT = 395;
  146. CANVAS_WIDTH = 770;
  147. this.onUnload = function()
  148. {
  149.    clearInterval(intervalID);
  150. };
  151. btnImage.onRelease = videoImageButtonPressed;
  152. mc_controls.mc_fullscreen_btn.full_screen_btn.onPress = videoGoFullscreen;
  153. mc_image.mc_close.close_screen_btn.onRelease = videoCloseFullscreen;
  154.